﻿using System;

namespace MLog.Core {
    public class StandardLoggerFactory : ILoggerFactory {
        public ILogger GetLogger(string name) {
            var loggerConfig = LoggerConfiguration.GetLoggerNearest(name);
            var className    = loggerConfig.GetAttr("class", Constants.DefaultLoggerImpl);
            var type         = Type.GetType(className);
            var logger       = (Logger) Activator.CreateInstance(type);
            logger.ApplyConfig(name, loggerConfig);
            return logger;
        }
    }
}